package xin.printk.android.module.plan;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;

import java.util.ArrayList;
import java.util.List;

import xin.printk.android.BasicActivity;
import xin.printk.android.R;
import xin.printk.android.utils.AppConstants;
import xin.printk.android.utils.PrefUtils;
import xin.printk.android.view.adapter.SimpleFragmentPagerAdapter;

public class PlanActivity extends BasicActivity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_plan);
        Toolbar mToolbar = findViewById(R.id.plan_toolbar);
        setToolbar(mToolbar);
        setCanFinish(true);

        TabLayout mPlanTabLayout = findViewById(R.id.tab_plan_layout);
        mPlanTabLayout.setBackgroundColor(getThemeColor());
        ViewPager mPlanPager = findViewById(R.id.vp_plan_pager);
        List<Fragment> mFragments = new ArrayList<>();
        mFragments.add(new UndonePlanFragment());
        mFragments.add(new CompletedPlanFragment());
        List<String> mTitles = new ArrayList<>();
        mTitles.add(getString(R.string.plan_undone));
        mTitles.add(getString(R.string.plan_completed));
        FragmentPagerAdapter mPagerAdapter = new SimpleFragmentPagerAdapter(getSupportFragmentManager(), mFragments, mTitles);
        mPlanPager.setAdapter(mPagerAdapter);
        mPlanTabLayout.setupWithViewPager(mPlanPager);
    }
}
